﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="YYShipmentListEasyUI.aspx.cs" Inherits="IHISCETeim.Web.MachineSys.YYModel.YYShipmentListEasyUI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <link rel="stylesheet" type="text/css" href="../EasyUI/themes/default/easyui.css"/>
	<link rel="stylesheet" type="text/css" href="../EasyUI/themes/icon.css" />
	<script type="text/javascript" src="../js/jquery-1.7.2.min.js"></script>   
	<script type="text/javascript" src="../EasyUI/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-lang-zh_CN.js"></script>
    <script type="text/javascript" src="../EasyUI/easyui-formatter_20140718.js"></script>
     <link href="../themes/css/jquery.autocomplete.css" rel="stylesheet" type="text/css" />
    <script src="../js/DWZ/jquery.autocomplete.js" type="text/javascript"></script>
    <script type="text/javascript">
         ///自适应宽高
       $(window).resize(function(){		    
             $("#tab_list").datagrid({
                    width: '100%',
                    height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
             }); 
	    });

        $(document).ready(function () {
             //权限处理
            var $powers={
                "r查看":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.查看) %>,
                "r新增":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.新增) %>,
                "r修改":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.修改) %>,
                "r删除":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.删除) %>,
                "r导出":<%=HasPowerEasyUI(IHISCETeim.Web.Permission.导出) %> 
            };
            var $tab_toolbar=$("#tab_toolbar");
            $tab_toolbar.find("a").each(function(){
                var $per=$(this).attr("Permission");
                var pt= $powers[$per]==undefined || null?true:$powers[$per];
                $(this).linkbutton(pt?'enable': 'disable');
            })

            //自动完成
            $(".autocomplete").each(function () {
                var $this = $(this);
                var url = unescape($this.attr("autocompletehref"));
                $this.autocomplete(url);
            });
            //条件查询
            $("#search-buttons").find("#btn_search").click(function () {
                var query = $("#tab_search").serializeJSON(); // GetInputData("tab_search", "query");
                query.action = "query";
                $('#tab_list').datagrid("options").queryParams = query;
                $('#tab_list').datagrid('load');
                $("#tab_search").dialog("close");
                return false;
            });

            var lastIndex;
            $('#tab_list').datagrid({               
                url: location.href,
                queryParams: { "action": "query" },
                width: '100%', //宽度    
                height: $(parent.document).find(".tabsPageContent").height() - 11 > 0 ? $(parent.document).find(".tabsPageContent").height() - 11 : 500,
                toolbar: "#tab_toolbar",
                rowStyler:function(index,row)
                {
                    if(row.Status=="已发")
                        return  "color:red;";  
                },
                onClickRow: function (rowIndex) {
                    return false;
                    if(<%=HasPowerEasyUI(IHISCETeim.Web.Permission.修改) %>==false || <%=HasPowerEasyUI(IHISCETeim.Web.Permission.修改) %>==undefined )
                    {
                        return false;
                    }
		            if (lastIndex != rowIndex) {
		                $('#tab_list').datagrid('endEdit', lastIndex);
		               
		                $('#tab_list').datagrid('beginEdit', rowIndex);
		            }
		            lastIndex = rowIndex;
		        },
		        onAfterEdit: function (rowIndex, rowData, changes) {
                  var $data={};
                  $data["ShipmentID"]=rowData.ShipmentID;
                  if(changes.Status==undefined)
                    return;
                  $data["Status"]=changes.Status;
                  $data["action"]="editrow";             
                   $.ajax({
                        type: 'post',
                        url: location.href,
                        data:$data,
                        async: true,
                        cache: false,
                        dataType: "text",
                        success: function (json) {
                            try {
                                if (json!="") {
                                   alert(json);
                                }
                            }
                            catch (e) {

                            }
                        }
                    });
		        }
            });   
        })

        function onAddClick()
        {
            var rel = "YYShipmentAdd";
            var url = "YYModel/YYShipmentAdd.aspx";
            var title = "添加出货进度";
            var options = { width: 850, height: 350, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.$.pdialog.open(url, rel, title, options);
            //top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            return false;
        }
         //修改，通过工具栏
        function onEditClick() {

            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要修改的出货进度记录');
                return false;
            }           

            var ShipmentID = row.ShipmentID;
            var rel = "FTradeCatheringEdit";
            var url = "YYModel/YYShipmentEdit.aspx?ShipmentID=" + ShipmentID;
            var title = "修改出货进度记录";
            var options = { width: 850, height: 455, max: false, mask: true, maxable: false, minable: false, fresh: true, resizable: false, drawable: true };
            top.$.pdialog.open(url, rel, title, options);
           // top.navTab.openTab(rel, url, { title: title, fresh: true, external: false });
            return false;
        }
        //删除
        function onDelClick() {

            var row = $('#tab_list').datagrid('getSelected')
            if (row == null) {
                $.messager.alert('提示', '请先选择要删除的记录');
                return false;
            }
            var ShipmentID = row.ShipmentID;


            $.messager.confirm('提示', '您确认要删除此出货进度记录吗？', function (r) {
                if (r) {
                   // var FTradeID = row.FTradeID;
                    var url = "sysAjaxDone.ashx?ajaxmethod=deleteyyshopment&ShipmentID=" + ShipmentID;
                    top.ajaxTodo(url, "");
                    $("#tab_list").datagrid("load");
                }
            });


            return false;
        }
    </script>
     
</head>
<body style="margin:2px;" >
     <div id="tab_search" title="查询条件" style=" height:250px; width:500px;" class="easyui-dialog" modal="true" closed="true" buttons="#search-buttons">
        <table class="table_search" width="100%" style=" line-height:21px;">
            <tr>
                <td width="80px">经销商:</td>
                <td width="120px">               
                    <input  name="AgentName"  class="autocomplete" autocompletehref="<%=AutoCompleteRequestUrl %>?ajaxmethod=getagentlist" mustMatch="true" swidth="300" showinputid=""/>
                </td>
                <td width="80px">是否发货:</td>
                <td width="80px">
                    <select name="Status">
                        <option value="所有">所有</option>
                        <option value="已发">已发</option>
                        <option value="未发" selected>未发</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>机型:</td>
                 <td >               
                    <input  name="MacType"  class="" />
                </td>
                <td>机号:</td>
                 <td >               
                    <input  name="SerialNumber"  class="" />
                </td>
            </tr>
              <tr>
                <td>
                    实际出货日期：
                </td>
                <td  >                    
                    <input name="OutDateFrom" class="easyui-datebox" type="text" value="" />
                  
                </td>
                <td>
                      到
                </td>
                <td><input name="OutDateTo" type="text" class="easyui-datebox" value="" /></td>
            </tr>
            <tr>
                <td>
                    预计出货：
                </td>
                <td  >                    
                    <input name="ExpectOutDateFrom" class="easyui-datebox" type="text" value="" />
                  
                </td>
                <td>
                      到
                </td>
                <td><input name="ExpectOutDateTo" type="text" class="easyui-datebox" value="" /></td>
            </tr>
        </table>
        <div id="search-buttons" style=" ">
            <a id="btn_search" href="javascript:;" class="easyui-linkbutton" iconcls="icon-search" plain="true">提交</a> 
            <a href="javascript:;" class="easyui-linkbutton" onclick="$('#tab_search').dialog('close');return false;" iconcls="icon-cancel" plain="true">取消</a>
        </div>
    </div>

    <div id="tab_toolbar" style="padding:2px;">
       <a href="#" title="高级查找" class="easyui-linkbutton" iconcls="icon-search" plain="true" onclick="$('#tab_search').dialog('open');" Permission="">查找</a>
       <a href="#" title="新增" class="easyui-linkbutton" iconcls="icon-add" plain="true" onclick="return onAddClick()" Permission="r新增">新增</a>
       <a href="#" title="修改" class="easyui-linkbutton" iconcls="icon-save" plain="true" onclick="return　onEditClick();" Permission="r修改">修改</a>
       <a href="#" title="删除" class="easyui-linkbutton" iconcls="icon-remove" plain="true" onclick="return　onDelClick();" Permission="r删除" >删除</a> 
       <a href="#"  class="easyui-linkbutton" iconcls="icon-btnDown" plain="true" onclick="return onExportList();" Permission="r导出" style=" display:none">导出</a>

    </div>   

   <table id="tab_list" sortName="ShipmentID" sortOrder="DESC" iconCls="" singleSelect="true" idField="ShipmentID"  nowrap="false" striped="true" collapsible="false" remoteSort="true"  toolbar="#tab_toolbar"  pagination="true" pageNumber="1" pageSize="<%=numPerPage %>"  pageList="<%=SetnumPerPage() %>" rownumbers="true" showFooter="false" url="">
		<thead>
			<tr>
                <th field="OrderDate" width="100"  sortable="true">订单日期</th>
				<th field="ExpectOutDate" width="100" formatter="formatterdate" sortable="true">预计出货日期</th>
				<th field="AgentName" width="100" sortable="true">经销商</th>
				<th field="MacType" width="80"  sortable="true">机型</th>
				<th field="SerialNumber" width="80" sortable="true">机号</th>
                <th field="ReadyDate" width="100"  sortable="true">备货完成日期</th>
                <th field="OutDate" width="100"  sortable="true">出货日期</th>
                <th field="ShippingCmpt" width="100"  sortable="true">运输公司</th>
				<th field="ShippingType" width="80" sortable="true">出货类型</th>
                <th field="ShippingClass" width="80" sortable="true">运输方式</th>
                 <th field="IsInsure" width="80" sortable="true">运输险投保</th>
				<th field="Status" width="80" align="center" editor="{type:'checkbox',options:{on:'已发',off:'未发'}}" sortable="true">是否发货</th>
                <th field="Remark"  width="260" >备注</th>
			</tr>
		</thead>
	</table>
</body>
</html>
